package com.das.mechanic_base.widget;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.das.mechanic_base.R;
import com.das.mechanic_base.adapter.visit.X3LittleAssistantAdapter;
import com.das.mechanic_base.base.X3BaseBottomSheetDialog;
import com.das.mechanic_base.bean.little.LittleAssistantBean;
import com.das.mechanic_base.bean.main.HomeUserBean;
import com.umeng.analytics.MobclickAgent;

import java.util.ArrayList;
import java.util.List;

/**
 * 话述小助手
 */
public class X3LittleAssistantDialog extends X3BaseBottomSheetDialog {

    private RecyclerView little_view_rl;
    private X3LittleAssistantAdapter littleAssistantAdapter;
    private List<HomeUserBean.ListBean> mList;
    private ImageView title_back_img;
    private TextView little_views_tvv;

    public X3LittleAssistantDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected boolean getDialogCancel() {
        return false;
    }

    @Override
    public void initView() {
        little_views_tvv=findViewById(R.id.little_views_tvv);
        title_back_img=findViewById(R.id.title_back_img);
        little_view_rl = findViewById(R.id.little_views_rl);
        mList=new ArrayList<>();
        littleAssistantAdapter=new X3LittleAssistantAdapter(mContext);
        little_view_rl.setLayoutManager(new LinearLayoutManager(mContext));
        little_view_rl.setAdapter(littleAssistantAdapter);
        title_back_img.setOnClickListener(v -> dismiss());

    }

    @Override
    protected int getLayoutId() {
        return R.layout.x3_activity_little_assistant;
    }

    public void getshowData(List<LittleAssistantBean> littleAssistantBean){
        if(littleAssistantAdapter==null){
            little_view_rl.setVisibility(View.GONE);
            little_views_tvv.setVisibility(View.VISIBLE);
        }else {
            little_view_rl.setVisibility(View.VISIBLE);
            little_views_tvv.setVisibility(View.GONE);
            littleAssistantAdapter.changeData(littleAssistantBean);
        }
    }
    @Override
    protected void onStart() {
        super.onStart();
        MobclickAgent.onPageStart("话术小助手弹窗");
    }

    @Override
    protected void onStop() {
        super.onStop();
        MobclickAgent.onPageEnd("话术小助手弹窗");
    }
}
